package com.Homework2;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Test10 {
    public static void main(String[] args) {
        HashMap<String, String> map = new HashMap<>();
        int count=1;
        while (map.size()<=5){
            System.out.println("请输入第"+count+++"本书，以书本，价格的方式");
            String input = new Scanner(System.in).nextLine();
            String[] split = input.split(",");
            map.put(split[0],split[1]);
            map.remove("C++");
            map.put("java","38.5");
        }
        Set<String> strings = map.keySet();
        for (String string : strings) {
            System.out.println(string+"--"+map.get(string));
        }
        Set<Map.Entry<String, String>> entries = map.entrySet();
        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey()+"--"+entry.getValue());
        }
    }
}
